home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / include / inline / muimaster.h
Encoding:
C/C++ Source or Header  |  1995-03-30  |  9.8 KB  |  359 lines

  1. #ifndef _INLINE_MUIMASTER_H
  2. #define _INLINE_MUIMASTER_H
  3.  
  4. #define __INLINE_STDARG_BROKEN__
  5.  
  6. #if !defined(__GNUC__)
  7. #error This file is for GNU-C only
  8. #elif !defined(mc68000)
  9. #error This file is for m68k systems only
  10. #else
  11.  
  12. #include <sys/cdefs.h>
  13.  
  14. #ifndef INTUITION_CLASSES_H
  15. #include <intuition/classes.h>
  16. #endif
  17.  
  18. #ifndef UTILITY_TAGITEM_H
  19. #include <utility/tagitem.h>
  20. #endif
  21.  
  22. __BEGIN_DECLS
  23.  
  24. #ifndef BASE_EXT_DECL
  25. #define BASE_EXT_DECL
  26. #define BASE_EXT_DECL0 extern struct Library *MUIMasterBase;
  27. #endif
  28. #ifndef BASE_PAR_DECL
  29. #define BASE_PAR_DECL
  30. #define BASE_PAR_DECL0 void
  31. #endif
  32. #ifndef BASE_NAME
  33. #define BASE_NAME MUIMasterBase
  34. #endif
  35.  
  36. BASE_EXT_DECL0
  37.  
  38. /************************************************************************/
  39.  
  40. extern __inline APTR MUI_AllocAslRequest(BASE_PAR_DECL ULONG type, const struct TagItem *TagList)
  41.  
  42. {
  43.   BASE_EXT_DECL
  44.   register APTR res __asm("d0");
  45.   register struct Library *a6 __asm("a6") = BASE_NAME;
  46.   register ULONG d0 __asm("d0") = type;
  47.   register const struct TagItem *a0 __asm("a0") = TagList;
  48.  
  49.   __asm volatile ("jsr a6@(-0x30)"
  50.           : "=r" (res)
  51.           : "r" (a6), "r" (d0), "r" (a0)
  52.           : "d0","d1", "a0", "a1", "cc" );
  53.   return res;
  54. }
  55.  
  56. #if !defined(NO_INLINE_STDARG) && !defined(__INLINE_STDARG_BROKEN__)
  57. #define MUI_AllocAslRequestTags(type, tags...) ({struct TagItem _tags[]={tags}; return MUI_AllocAslRequest(type,_tags);})
  58. #endif
  59.  
  60. /************************************************************************/
  61.  
  62. extern __inline BOOL MUI_AslRequest(BASE_PAR_DECL APTR requester, const struct TagItem *TagList)
  63.  
  64. {
  65.   BASE_EXT_DECL
  66.   register BOOL res __asm("d0");
  67.   register struct Library *a6 __asm("a6") = BASE_NAME;
  68.   register APTR a0 __asm("a0") = requester;
  69.   register const struct TagItem *a1 __asm("a1") = TagList;
  70.  
  71.   __asm volatile ("jsr a6@(-0x36)"
  72.           : "=r" (res)
  73.           : "r" (a6), "r" (a0), "r" (a1)
  74.           : "d0", "d1", "a0", "a1", "memory", "cc" );
  75.   return res;
  76. }
  77.  
  78. #if !defined(NO_INLINE_STDARG) && !defined(__INLINE_STDARG_BROKEN__)
  79. #define MUI_AslRequestTags(req, tags...) ({struct TagItem _tags[]={tags}; return MUI_AslRequest(req,_tags);})
  80. #endif
  81.  
  82. /************************************************************************/
  83.  
  84. extern __inline struct MUI_CustomClass *MUI_CreateCustomClass(BASE_PAR_DECL
  85.                                   struct Library *LibraryBase,
  86.                                   const char *SuperName,
  87.                                   struct MUI_CustomClass *SuperMCC,
  88.                                   int Datasize,
  89.                                   APTR Dispatcher)
  90.  
  91. {
  92.   BASE_EXT_DECL
  93.   register struct MUI_CustomClass *res __asm("d0");
  94.   register struct Library *a6 __asm("a6") = BASE_NAME;
  95.   register struct Library *a0 __asm("a0") = LibraryBase;
  96.   register const char *a1 __asm("a1") = SuperName;
  97.   register struct MUI_CustomClass *a2 __asm("a2") = SuperMCC;
  98.   register int d0 __asm("d0") = Datasize;
  99.   register APTR a3 __asm("a3") = Dispatcher;
  100.  
  101.   __asm volatile ("jsr a6@(-0x6c)"
  102.           : "=r" (res)
  103.           : "r" (a6), "r" (a0), "r" (a1), "r" (a2), "r" (d0), "r" (a3)
  104.           : "d0", "d1", "a0", "a1", "cc");
  105.   return res;
  106. }
  107.  
  108. /************************************************************************/
  109.  
  110. extern __inline BOOL MUI_DeleteCustomClass(BASE_PAR_DECL struct MUI_CustomClass *mcc)
  111.  
  112. {
  113.   BASE_EXT_DECL
  114.   register BOOL res __asm("d0");
  115.   register struct Library *a6 __asm("a6") = BASE_NAME;
  116.   register struct MUI_CustomClass *a0 __asm("a0") = mcc;
  117.  
  118.   __asm volatile ("jsr a6@(-0x72)"
  119.           : "=r" (res)
  120.           : "r" (a6), "r" (a0)
  121.           : "d0", "d1", "a0", "a1", "cc" );
  122.   return res;
  123. }
  124.  
  125. /************************************************************************/
  126.  
  127. extern __inline void MUI_DisposeObject(BASE_PAR_DECL Object *TheObject)
  128.  
  129. {
  130.   BASE_EXT_DECL
  131.   register struct Library *a6 __asm("a6") = BASE_NAME;
  132.   register Object *a0 __asm("a0") = TheObject;
  133.  
  134.   __asm volatile ("jsr a6@(-0x24)"
  135.           :
  136.           : "r" (a6), "r" (a0)
  137.           : "d0", "d1", "a0", "a1", "cc" );
  138. }
  139.  
  140. /************************************************************************/
  141.  
  142. extern __inline LONG MUI_Error(BASE_PAR_DECL0)
  143.  
  144. {
  145.   BASE_EXT_DECL
  146.   register LONG res __asm("d0");
  147.   register struct Library *a6 __asm("a6") = BASE_NAME;
  148.  
  149.   __asm volatile ("jsr a6@(-0x42)"
  150.           : "=r" (res)
  151.           : "r" (a6)
  152.           : "d0", "d1", "a0", "a1", "cc" );
  153.   return res;
  154. }
  155.  
  156. /************************************************************************/
  157.  
  158. extern __inline void MUI_FreeAslRequest(BASE_PAR_DECL APTR requester)
  159.  
  160. {
  161.   BASE_EXT_DECL
  162.   register struct Library *a6 __asm("a6") = BASE_NAME;
  163.   register APTR a0 __asm("a0") = requester;
  164.  
  165.   __asm volatile ("jsr a6@(-0x3c)"
  166.           :
  167.           : "r" (a6), "r" (a0)
  168.           : "d0", "d1", "a0", "a1", "cc" );
  169. }
  170.  
  171. /************************************************************************/
  172.  
  173. extern __inline void MUI_FreeClass(BASE_PAR_DECL struct IClass *TheClass)
  174.  
  175. {
  176.   BASE_EXT_DECL
  177.   register struct Library *a6 __asm("a6") = BASE_NAME;
  178.   register struct IClass *a0 __asm("a0") = TheClass;
  179.  
  180.   __asm volatile ("jsr a6@(-0x54)"
  181.           :
  182.           : "r" (a6), "r" (a0)
  183.           : "d0", "d1", "a0", "a1", "cc" );
  184. }
  185.  
  186. /************************************************************************/
  187.  
  188. extern __inline struct IClass *MUI_GetClass(BASE_PAR_DECL const char *ClassName)
  189.  
  190. {
  191.   BASE_EXT_DECL
  192.   register struct IClass *res __asm("d0");
  193.   register struct Library *a6 __asm("a6") = BASE_NAME;
  194.   register const char *a0 __asm("a0")=ClassName;
  195.  
  196.   __asm volatile ("jsr a6@(-0x4e)"
  197.           : "=r" (res)
  198.           : "r" (a6), "r" (a0)
  199.           : "d0", "d1", "a0", "a1", "cc" );
  200.   return res;
  201. }
  202.  
  203. /************************************************************************/
  204.  
  205. extern __inline Object *MUI_MakeObjectA(BASE_PAR_DECL LONG Type, const ULONG *Params)
  206.  
  207. {
  208.   BASE_EXT_DECL
  209.   register Object *res __asm("d0");
  210.   register struct Library *a6 __asm("a6") = BASE_NAME;
  211.   register LONG d0 __asm("d0") = Type;
  212.   register const ULONG *a0 __asm("a0") = Params;
  213.  
  214.   __asm volatile ("jsr a6@(-0x78)"
  215.           : "=r" (res)
  216.           : "r" (a6), "r" (d0), "r" (a0)
  217.           : "d0", "d1", "a0", "a1", "cc" );
  218.   return res;
  219. }
  220.  
  221. #if !defined(NO_INLINE_STDARG) && !defined(__INLINE_STDARG_BROKEN__)
  222. #define MUI_MakeObject(type,params...) ({ULONG _params[]={params}; return MUI_MakeObjectA(type,_params);})
  223. #endif
  224.  
  225. /************************************************************************/
  226.  
  227. extern  __inline Object *MUI_NewObjectA(BASE_PAR_DECL const char *ClassName, const struct TagItem *TagList)
  228.  
  229. {
  230.   BASE_EXT_DECL
  231.   register Object *res __asm("d0");
  232.   register struct Library *a6 __asm("a6") = BASE_NAME;
  233.   register const char *a0 __asm("a0") = ClassName;
  234.   register const struct TagItem *a1 __asm("a1") = TagList;
  235.  
  236.   __asm volatile ("jsr a6@(-0x1e)"
  237.           : "=r" (res)
  238.           : "r" (a6), "r" (a0), "r" (a1)
  239.           : "d0", "d1", "a0", "a1", "cc" );
  240.   return res;
  241. }
  242.  
  243. #if !defined(NO_INLINE_STDARG) && !defined(__INLINE_STDARG_BROKEN__)
  244. #define MUI_NewObject(class, tags...) ({struct TagItem _tags[]={tags}; return MUI_NewObjectA(class,_tags);})
  245. #endif
  246.  
  247. /************************************************************************/
  248.  
  249. extern __inline void MUI_Redraw(BASE_PAR_DECL Object *TheObject, ULONG Flags)
  250.  
  251. {
  252.   BASE_EXT_DECL
  253.   register struct Library *a6 __asm("a6") = BASE_NAME;
  254.   register Object *a0 __asm("a0") = TheObject;
  255.   register ULONG d0 __asm("d0") = Flags;
  256.  
  257.   __asm volatile ("jsr a6@(-0x66)"
  258.           :
  259.           : "r" (a6), "r" (a0), "r" (d0)
  260.           : "d0", "d1", "a0", "a1", "cc", "memory" );
  261. }
  262.  
  263. /************************************************************************/
  264.  
  265. extern __inline void MUI_RejectIDCMP( BASE_PAR_DECL Object *TheObject, ULONG Flags)
  266.  
  267. {
  268.   BASE_EXT_DECL
  269.   register struct Library *a6 __asm("a6") = BASE_NAME;
  270.   register Object *a0 __asm("a0") = TheObject;
  271.   register ULONG  d0 __asm("d0") = Flags;
  272.  
  273.   __asm volatile ("jsr a6@(-0x60)"
  274.           :
  275.           : "r" (a6), "r" (a0), "r" (d0)
  276.           : "d0", "d1", "a0", "a1", "cc" );
  277. }
  278.  
  279. /************************************************************************/
  280.  
  281. extern __inline LONG MUI_RequestA(BASE_PAR_DECL
  282.                   Object *Application,
  283.                   Object *TheWindow,
  284.                   LONGBITS Flags,
  285.                   const char *Title,
  286.                   const char *Gadgets,
  287.                   const char *FormatString,
  288.                   APTR Params)
  289.  
  290. {
  291.   BASE_EXT_DECL
  292.   register LONG res __asm("d0");
  293.   register struct Library *a6 __asm("a6") = BASE_NAME;
  294.   register Object *d0 __asm("d0") = Application;
  295.   register Object *d1 __asm("d1") = TheWindow;
  296.   register LONGBITS d2 __asm("d2") = Flags;
  297.   register const char *a0 __asm("a0") = Title;
  298.   register const char *a1 __asm("a1") = Gadgets;
  299.   register const char *a2 __asm("a2") = FormatString;
  300.   register APTR a3 __asm("a3") = Params;
  301.  
  302.   __asm volatile ("jsr a6@(-0x2a)"
  303.           : "=r" (res)
  304.           : "r" (a6), "r" (d0), "r" (d1), "r" (d2), "r" (a0), "r" (a1), "r" (a2), "r" (a3)
  305.           : "d0", "d1", "a0", "a1", "cc" );
  306.   return res;
  307. }
  308.  
  309. #if !defined(NO_INLINE_STDARG) && !defined(__INLINE_STDARG_BROKEN__)
  310. #define MUI_Request(app,win,flags,title,gadgets,format,params...) ({union {LONG a, unsigned LONG b, void *c} _params[]={params}; return MUI_RequestA(app,win,flags,title,gadgets,format,_params);})
  311. #endif
  312.  
  313. /************************************************************************/
  314.  
  315. extern __inline void MUI_RequestIDCMP(BASE_PAR_DECL Object *TheObject, ULONG Flags)
  316.  
  317. {
  318.   BASE_EXT_DECL
  319.   register struct Library *a6 __asm("a6") = BASE_NAME;
  320.   register Object *a0 __asm("a0") = TheObject;
  321.   register ULONG  d0 __asm("d0") = Flags;
  322.  
  323.   __asm volatile ("jsr a6@(-0x5a)"
  324.           :
  325.           : "r" (a6), "r" (a0), "r" (d0)
  326.           : "d0", "d1", "a0", "a1", "cc" );
  327. }
  328.  
  329. /************************************************************************/
  330.  
  331. extern __inline LONG MUI_SetError(BASE_PAR_DECL LONG ErrorNum)
  332.  
  333. {
  334.   BASE_EXT_DECL
  335.   register LONG res __asm("d0");
  336.   register struct Library *a6 __asm("a6") = BASE_NAME;
  337.   register LONG d0 __asm("d0") = ErrorNum;
  338.  
  339.   __asm volatile ("jsr a6@(-0x48)"
  340.           : "=r" (res)
  341.           : "r" (a6), "r" (d0)
  342.           : "d0", "d1", "a0", "a1", "cc" );
  343.   return res;
  344. }
  345.  
  346. /************************************************************************/
  347.  
  348. #undef BASE_EXT_DECL
  349. #undef BASE_EXT_DECL0
  350. #undef BASE_PAR_DECL
  351. #undef BASE_PAR_DECL0
  352. #undef BASE_NAME
  353.  
  354. __END_DECLS
  355.  
  356. #endif
  357.  
  358. #endif /* _INLINE_MUIMASTER_H */
  359.